from django.db import models
from django10.utils.models import BaseModel
# Create your models here.
# 大众健康方向表
class HealthDirection(BaseModel):
    name = models.CharField(max_length=100,unique=True, verbose_name='大众健康方向名称')
    class Meta:
        db_table = 'health_direction'
        verbose_name_plural = '大众健康方向'
    def __str__(self):
        return self.name
# 大众健康分类表
class HealthCategory(BaseModel):
    name = models.CharField(max_length=100, verbose_name='大众健康分类名称')
    direction = models.ForeignKey(HealthDirection, related_name="category_list",null=True,blank=True,on_delete=models.DO_NOTHING, verbose_name='所属方向')
    class Meta:
        db_table = "health_category"
        verbose_name_plural = '大众健康分类'
    def __str__(self):
        return self.name
# 生活手册方向表
class LifeDirection(BaseModel):
    name = models.CharField(max_length=100, unique=True, verbose_name='大众健康方向名称')

    class Meta:
        db_table = 'life_direction'
        verbose_name_plural = '生活手册方向'

    def __str__(self):
        return self.name
# 生活手册分类表
class LifeCategory(BaseModel):
    name = models.CharField(max_length=100, verbose_name='大众健康分类名称')
    direction = models.ForeignKey(LifeDirection, related_name="category_list", null=True, blank=True,
                                  on_delete=models.DO_NOTHING, verbose_name='所属方向')

    class Meta:
        db_table = "life_category"
        verbose_name_plural = '生活手册分类'

    def __str__(self):
        return self.name